import Vue from 'vue'
import Router from 'vue-router'
import Index from '@/views/Index'

import gemfireRouters from '@/router/gemfire/gemfire'
import redisRouters from '@/router/redis/redis'
import processRouters from '@/router/process/process'
import utilRouters from '@/router/util/util'
import paybackRouters from '@/router/payback/payback'


Vue.use(Router)


const baseRoutes = [{
    path: '/',
    name: 'Index',
    component: Index
}];
//合并两个路由
const routes = baseRoutes.concat(gemfireRouters, redisRouters, processRouters,utilRouters, paybackRouters);

/**
 * 解决同路由跳转报错的vue的bug!
 * @type {{(location: RawLocation): Promise<Route>; (location: RawLocation, onComplete?: Function, onAbort?: ErrorHandler): void}}
 */
const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err)
}

export default new Router({
    routes
})




